//+------------------------------------------------------------------+
//|                                                 IregNotifier.mq4 |
//|                                         Copyright © 2011, NdsNks |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, NdsNks"
#property link      "Moutza Ae"

double regup, regdown; 
extern string    SoundFileName="alarm.wav";


#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
      Comment("");
      ObjectDelete("I-regr Notifier");
      ObjectDelete("RegUp");
      ObjectDelete("RegDown");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
//----
  regup = iCustom(NULL,0,"i-Regr",3,2,250,0,1,0);
  regdown = iCustom(NULL,0,"i-Regr",3,2,250,0,2,0);
  
  if(Ask>regup){
  Alert("IREGR BROKE UP: ",Symbol()," M",Period()," Price: ",Ask);
  if(SoundFileName!="" )
         PlaySound( SoundFileName );
  }
  
  if(Ask<regdown){
  Alert("IREGR BROKE DOWN: ",Symbol()," M",Period()," Pric: ",Ask);
  if(SoundFileName!="" )
         PlaySound( SoundFileName );
  }
      ObjectCreate("I-regr Notifier", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("I-regr Notifier","I-regr Notifier",8,"Arial Black", White);
      ObjectSet("I-regr Notifier", OBJPROP_CORNER, 3);
      ObjectSet("I-regr Notifier", OBJPROP_XDISTANCE, 4);
      ObjectSet("I-regr Notifier", OBJPROP_YDISTANCE, 13);
      
      
      ObjectCreate("RegUP", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("RegUP",DoubleToStr(regup,Digits),8,"Arial Black", White);
      ObjectSet("RegUP", OBJPROP_CORNER, 3);
      ObjectSet("RegUP", OBJPROP_XDISTANCE, 4);
      ObjectSet("RegUP", OBJPROP_YDISTANCE, 47);

      ObjectCreate("RegDown", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("RegDown",DoubleToStr(regdown,Digits),8,"Arial Black", Red);
      ObjectSet("RegDown", OBJPROP_CORNER, 3);
      ObjectSet("RegDown", OBJPROP_XDISTANCE, 4);
      ObjectSet("RegDown", OBJPROP_YDISTANCE, 34);
   
      return(0);
  }
//+------------------------------------------------------------------+